package com.bitcola.security.me.biz;

import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.bitcola.security.common.biz.BaseBiz;
import com.bitcola.security.me.mapper.ColaAppBannerMapper;
import com.bitcola.entity.ColaAppBanner;
import tk.mybatis.mapper.entity.Example;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *  @author wx
 * @create 2019-03-20 11:04
 **/
@Service
public class ColaAppBannerBiz extends BaseBiz<ColaAppBannerMapper, ColaAppBanner> {
    @Cached(cacheType = CacheType.LOCAL,expire = 30)
    public List<ColaAppBanner> banner(String language) {
        Example example = new Example(ColaAppBanner.class);
        example.orderBy("index").asc();
        example.createCriteria().andEqualTo("language",language);
        List<ColaAppBanner> colaAppBanners = mapper.selectByExample(example);

        return colaAppBanners;
    }
}
